type MyPick<T, K extends keyof T> = {
    [P in K]: T[P];
};

interface Todo {
    title: string;
    description: string;
    completed: boolean;
}
type demo = MyPick<Todo, "title" | "completed">;

// Process
// "title" | "completed" ----> 要满足  K extends keyof T

// Todo
/** T
 * interface Todo {
  title: string
  description: string
  completed: boolean
}
 */

/**
 * K 要完全属于 T 的子集
 * 返回的 type 里面每一项都是K中拿到的
 * 'title' | 'completed' | 'invalid'
 */
